package com.xufang.demo;

import redis.clients.jedis.Jedis;

import java.util.Set;

public class Demo5 {
    public static void main(String[] args) {
        Jedis jedis = new Jedis("192.168.137.103", 6379);
        
        // 添加数据 默认情况下分数越小越靠前
        jedis.zadd("zset",0.1, "111");
        jedis.zadd("zset",1.0, "222");
        jedis.zadd("zset",0.9, "333");
        
        // 遍历
        Set<String> stringSet = jedis.zrange("zset", 0, 1);
        for (String s : stringSet) {
            System.out.println(s);
        }
    
        // 释放资源
        jedis.close();
    }
}
